﻿@model ZKEACMS.FormGenerator.Models.FormField
<div class="form-group size-@Model.Size">
    @if (Model.DisplayName.IsNotNullAndWhiteSpace())
    {
        <label class="control-label" for="@Model.ID">
            @Model.DisplayName
            @if (Model.IsRequired)
            {
                <span class="required">*</span>
            }
        </label>
    }
    <div>
        @for (int i = 0; i < Model.FieldOptions.Count; i++)
        {
            <div class="checkbox">
                <label>
                    <input type="checkbox"
                           data-val="false"
                           class="@(Model.IsRequired?"required-one":"")"
                           value="@Model.FieldOptions[i].Value"
                           checked="@Model.FieldOptions[i].Selected"
                           name="@("{0}[{1}]".FormatWith(Model.ID,i))">
                    @Model.FieldOptions[i].DisplayText
                </label>
            </div>
        }

    </div>
    <span class="field-validation-valid" data-valmsg-for="@Model.ID" data-valmsg-replace="true">
        <span id="@(Model.ID)-error" class="">@L("请至少选择一个选项")</span>
    </span>
    @if (Model.Description.IsNotNullAndWhiteSpace())
    {
        <dl>
            <dd>
                @Model.Description
            </dd>
        </dl>
    }
</div>